<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquickanimation.cpp -->
  <title>PropertyAnimation QML 类型 | Qt Quick 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtquick-index.html">Qt Quick 模块</a></td><td ><a href="qtquick-qmlmodule.html">QML类型</a></td><td >PropertyAnimation QML 类型</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtquick-index.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">目录</a></h3>
<ul>
<li class="level1"><a href="#properties">属性</a></li>
<li class="level1"><a href="#details">详细信息</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">PropertyAnimation QML 类型</h1>
<span class="subtitle"></span>
<!-- $$$PropertyAnimation-brief -->
<p>Animates changes in property values. <a href="#details">更多...</a></p>
<!-- @@@PropertyAnimation -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> 导入语句：</td><td class="memItemRight bottomAlign"> import QtQuick 2.12</td></tr><tr><td class="memItemLeft rightAlign topAlign">继承自：</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-animation.html">Animation</a></p>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> 被继承：</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-coloranimation.html">ColorAnimation</a>, <a href="qml-qtquick-numberanimation.html">NumberAnimation</a>, <a href="qml-qtquick-rotationanimation.html">RotationAnimation</a>, and <a href="qml-qtquick-vector3danimation.html">Vector3dAnimation</a></p>
</td></tr></table></div><ul>
<li><a href="qml-qtquick-propertyanimation-members.html">所有成员的列表，包括继承成员</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">属性</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#duration-prop">duration</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#easing-prop">easing</a></b></b><ul>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#easing.type-prop">easing.type</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#easing.amplitude-prop">easing.amplitude</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#easing.overshoot-prop">easing.overshoot</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#easing.period-prop">easing.period</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#easing.bezierCurve-prop">easing.bezierCurve</a></b></b> : list&lt;real&gt;</li>
</ul>
</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#exclude-prop">exclude</a></b></b> : list&lt;Object&gt;</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#from-prop">from</a></b></b> : variant</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#properties-prop">properties</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#property-prop">property</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#target-prop">target</a></b></b> : Object</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#targets-prop">targets</a></b></b> : list&lt;Object&gt;</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#to-prop">to</a></b></b> : variant</li>
</ul>
<!-- $$$PropertyAnimation-description -->
<a name="details"></a>
<h2 id="details">详细信息</h2>
<p><a href="qtquick-animation-example.html#propertyanimation">PropertyAnimation</a> provides a way to animate changes to a property's value.</p>
<p>It can be used to define animations in a number of ways:</p>
<ul>
<li>In a <a href="qmlexampletoggleswitch.html#transition">Transition</a><p>For example, to animate any objects that have changed their <code>x</code> or <code>y</code> properties as a result of a state change, using an <code>InOutQuad</code> easing curve:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">rect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="string">&quot;red&quot;</span>

      <span class="name">states</span>: <span class="name">State</span> {
          <span class="name">name</span>: <span class="string">&quot;moved&quot;</span>
          <span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">rect</span>; <span class="name">x</span>: <span class="number">50</span> }
      }

      <span class="name">transitions</span>: <span class="name">Transition</span> {
          <span class="type"><a href="qml-qtquick-propertyanimation.html">PropertyAnimation</a></span> { <span class="name">properties</span>: <span class="string">&quot;x,y&quot;</span>; <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">InOutQuad</span> }
      }
  }

</pre>
</li>
<li>In a <a href="qml-qtquick-behavior.html">Behavior</a><p>For example, to animate all changes to a rectangle's <code>x</code> property:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="string">&quot;red&quot;</span>

      Behavior on <span class="name">x</span> { <span class="type"><a href="qml-qtquick-propertyanimation.html">PropertyAnimation</a></span> {} }

      <span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> { <span class="name">anchors</span>.fill: <span class="name">parent</span>; <span class="name">onClicked</span>: <span class="name">parent</span>.<span class="name">x</span> <span class="operator">=</span> <span class="number">50</span> }
  }

</pre>
</li>
<li>As a property value source<p>For example, to repeatedly animate the rectangle's <code>x</code> property:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="string">&quot;red&quot;</span>

      SequentialAnimation on <span class="name">x</span> {
          <span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span>
          <span class="type"><a href="qml-qtquick-propertyanimation.html">PropertyAnimation</a></span> { <span class="name">to</span>: <span class="number">50</span> }
          <span class="type"><a href="qml-qtquick-propertyanimation.html">PropertyAnimation</a></span> { <span class="name">to</span>: <span class="number">0</span> }
      }
  }

</pre>
</li>
<li>In a signal handler<p>For example, to fade out <code>theObject</code> when clicked:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
      <span class="name">anchors</span>.fill: <span class="name">theObject</span>
      <span class="name">onClicked</span>: <span class="name">PropertyAnimation</span> { <span class="name">target</span>: <span class="name">theObject</span>; <span class="name">property</span>: <span class="string">&quot;opacity&quot;</span>; <span class="name">to</span>: <span class="number">0</span> }
  }

</pre>
</li>
<li>Standalone<p>For example, to animate <code>rect</code>'s <code>width</code> property over 500ms, from its current width to 30:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">theRect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="string">&quot;red&quot;</span>

      <span class="comment">// this is a standalone animation, it's not running by default</span>
      <span class="type"><a href="qml-qtquick-propertyanimation.html">PropertyAnimation</a></span> { <span class="name">id</span>: <span class="name">animation</span>;
                          <span class="name">target</span>: <span class="name">theRect</span>;
                          <span class="name">property</span>: <span class="string">&quot;width&quot;</span>;
                          <span class="name">to</span>: <span class="number">30</span>;
                          <span class="name">duration</span>: <span class="number">500</span> }

      <span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> { <span class="name">anchors</span>.fill: <span class="name">parent</span>; <span class="name">onClicked</span>: <span class="name">animation</span>.<span class="name">running</span> <span class="operator">=</span> <span class="number">true</span> }
  }

</pre>
</li>
</ul>
<p>Depending on how the animation is used, the set of properties normally used will be different. For more information see the individual property documentation, as well as the <a href="qtquick-statesanimations-animations.html">Animation and Transitions in Qt Quick</a> introduction.</p>
<p>Note that <a href="qtquick-animation-example.html#propertyanimation">PropertyAnimation</a> inherits the abstract <a href="qml-qtquick-animation.html">Animation</a> type. This includes additional properties and methods for controlling the animation.</p>
<p><b>请参考 </b><a href="qtquick-statesanimations-animations.html">Animation 和 Transitions in Qt Quick</a> 和 <a href="qtquick-animation-example.html">Qt Quick 示例 - Animation</a>。</p>
<!-- @@@PropertyAnimation -->
<h2>属性文档</h2>
<!-- $$$duration -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="duration-prop">
<td class="tblQmlPropNode"><p>
<a name="duration-prop"></a><span class="name">duration</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the duration of the animation, in milliseconds.</p>
<p>The default value is 250.</p>
</div></div><!-- @@@duration -->
<br/>
<!-- $$$easing -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="even" id="easing-prop"><th class="centerAlign"><p><a name="easing-prop"></a><b>easing group</b></p></th></tr><tr valign="top" class="odd" id="easing.type-prop"><td class="tblQmlPropNode"><p><a name="easing.type-prop"></a><span class="name">easing.type</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr><tr valign="top" class="odd" id="easing.amplitude-prop"><td class="tblQmlPropNode"><p><a name="easing.amplitude-prop"></a><span class="name">easing.amplitude</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="easing.overshoot-prop"><td class="tblQmlPropNode"><p><a name="easing.overshoot-prop"></a><span class="name">easing.overshoot</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="easing.period-prop"><td class="tblQmlPropNode"><p><a name="easing.period-prop"></a><span class="name">easing.period</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr><tr valign="top" class="odd" id="easing.bezierCurve-prop"><td class="tblQmlPropNode"><p><a name="easing.bezierCurve-prop"></a><span class="name">easing.bezierCurve</span> : <span class="type"><a href="../qtqml/qml-list.html">list</a></span>&lt;<span class="type"><a href="../qtqml/qml-real.html">real</a></span>&gt;</p></td></tr></table></div></div><div class="qmldoc"><p>Specifies the easing curve used for the animation</p>
<p>To specify an easing curve you need to specify at least the type. For some curves you can also specify amplitude, period and/or overshoot (more details provided after the table). The default easing curve is <code>Easing.Linear</code>.</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-propertyanimation.html">PropertyAnimation</a></span> { <span class="name">properties</span>: <span class="string">&quot;y&quot;</span>;
                      <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">InOutElastic</span>;
                      <span class="name">easing</span>.amplitude: <span class="number">2.0</span>;
                      <span class="name">easing</span>.period: <span class="number">1.5</span> }

</pre>
<p>Available types are:</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><code>Easing.Linear</code></td><td >Easing curve for a linear (t) function: velocity is constant.</td><td ><img src="images/qeasingcurve-linear.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InQuad</code></td><td >Easing curve for a quadratic (t^2) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-inquad.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutQuad</code></td><td >Easing curve for a quadratic (t^2) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outquad.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutQuad</code></td><td >Easing curve for a quadratic (t^2) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutquad.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInQuad</code></td><td >Easing curve for a quadratic (t^2) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinquad.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InCubic</code></td><td >Easing curve for a cubic (t^3) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-incubic.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutCubic</code></td><td >Easing curve for a cubic (t^3) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outcubic.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutCubic</code></td><td >Easing curve for a cubic (t^3) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutcubic.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInCubic</code></td><td >Easing curve for a cubic (t^3) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outincubic.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InQuart</code></td><td >Easing curve for a quartic (t^4) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-inquart.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutQuart</code></td><td >Easing curve for a quartic (t^4) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outquart.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutQuart</code></td><td >Easing curve for a quartic (t^4) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutquart.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInQuart</code></td><td >Easing curve for a quartic (t^4) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinquart.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InQuint</code></td><td >Easing curve for a quintic (t^5) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-inquint.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutQuint</code></td><td >Easing curve for a quintic (t^5) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outquint.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutQuint</code></td><td >Easing curve for a quintic (t^5) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutquint.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInQuint</code></td><td >Easing curve for a quintic (t^5) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinquint.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InSine</code></td><td >Easing curve for a sinusoidal (sin(t)) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-insine.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutSine</code></td><td >Easing curve for a sinusoidal (sin(t)) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outsine.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutSine</code></td><td >Easing curve for a sinusoidal (sin(t)) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutsine.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInSine</code></td><td >Easing curve for a sinusoidal (sin(t)) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinsine.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InExpo</code></td><td >Easing curve for an exponential (2^t) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-inexpo.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutExpo</code></td><td >Easing curve for an exponential (2^t) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outexpo.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutExpo</code></td><td >Easing curve for an exponential (2^t) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutexpo.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInExpo</code></td><td >Easing curve for an exponential (2^t) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinexpo.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InCirc</code></td><td >Easing curve for a circular (sqrt(1-t^2)) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-incirc.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutCirc</code></td><td >Easing curve for a circular (sqrt(1-t^2)) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outcirc.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutCirc</code></td><td >Easing curve for a circular (sqrt(1-t^2)) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutcirc.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInCirc</code></td><td >Easing curve for a circular (sqrt(1-t^2)) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outincirc.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InElastic</code></td><td >Easing curve for an elastic (exponentially decaying sine wave) function: accelerating from zero velocity. <br />
 The peak amplitude can be set with the <i>amplitude</i> parameter, and the period of decay by the <i>period</i> parameter.</td><td ><img src="images/qeasingcurve-inelastic.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutElastic</code></td><td >Easing curve for an elastic (exponentially decaying sine wave) function: decelerating to zero velocity. <br />
 The peak amplitude can be set with the <i>amplitude</i> parameter, and the period of decay by the <i>period</i> parameter.</td><td ><img src="images/qeasingcurve-outelastic.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutElastic</code></td><td >Easing curve for an elastic (exponentially decaying sine wave) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutelastic.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInElastic</code></td><td >Easing curve for an elastic (exponentially decaying sine wave) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinelastic.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InBack</code></td><td >Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-inback.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutBack</code></td><td >Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing out: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outback.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutBack</code></td><td >Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutback.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInBack</code></td><td >Easing curve for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinback.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InBounce</code></td><td >Easing curve for a bounce (exponentially decaying parabolic bounce) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-inbounce.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutBounce</code></td><td >Easing curve for a bounce (exponentially decaying parabolic bounce) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outbounce.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutBounce</code></td><td >Easing curve for a bounce (exponentially decaying parabolic bounce) function easing in/out: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutbounce.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInBounce</code></td><td >Easing curve for a bounce (exponentially decaying parabolic bounce) function easing out/in: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinbounce.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.Bezier</code></td><td >Custom easing curve defined by the easing.bezierCurve property.</td><td ></td></tr>
</table></div>
<p><code>easing.amplitude</code> is only applicable for bounce and elastic curves (curves of type <code>Easing.InBounce</code>, <code>Easing.OutBounce</code>, <code>Easing.InOutBounce</code>, <code>Easing.OutInBounce</code>, <code>Easing.InElastic</code>, <code>Easing.OutElastic</code>, <code>Easing.InOutElastic</code> or <code>Easing.OutInElastic</code>).</p>
<p><code>easing.overshoot</code> is only applicable if <code>easing.type</code> is: <code>Easing.InBack</code>, <code>Easing.OutBack</code>, <code>Easing.InOutBack</code> or <code>Easing.OutInBack</code>.</p>
<p><code>easing.period</code> is only applicable if easing.type is: <code>Easing.InElastic</code>, <code>Easing.OutElastic</code>, <code>Easing.InOutElastic</code> or <code>Easing.OutInElastic</code>.</p>
<p><code>easing.bezierCurve</code> is only applicable if easing.type is: <code>Easing.Bezier</code>. This property is a list&lt;real&gt; containing groups of three points defining a curve from 0,0 to 1,1 - control1, control2, end point: [cx1, cy1, cx2, cy2, endx, endy, ..&#x2e;]&#x2e; The last point must be 1,1.</p>
<p>See the <a href="qtquick-animation-example.html#easing-curves">Easing Curves</a> for a demonstration of the different easing settings.</p>
</div></div><!-- @@@easing -->
<br/>
<!-- $$$exclude -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="exclude-prop">
<td class="tblQmlPropNode"><p>
<a name="exclude-prop"></a><span class="name">exclude</span> : <span class="type"><a href="../qtqml/qml-list.html">list</a></span>&lt;<span class="type">Object</span>&gt;</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the items not to be affected by this animation.</p>
<p><b>请参考 </b><a href="qml-qtquick-propertyanimation.html#targets-prop">PropertyAnimation::targets</a>。</p>
</div></div><!-- @@@exclude -->
<br/>
<!-- $$$from -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="from-prop">
<td class="tblQmlPropNode"><p>
<a name="from-prop"></a><span class="name">from</span> : <span class="type"><a href="../qtqml/qml-variant.html">variant</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the starting value for the animation.</p>
<p>If the <a href="qtquick-animation-example.html#propertyanimation">PropertyAnimation</a> is defined within a <a href="qmlexampletoggleswitch.html#transition">Transition</a> or <a href="qml-qtquick-behavior.html">Behavior</a>, this value defaults to the value defined in the starting state of the <a href="qmlexampletoggleswitch.html#transition">Transition</a>, or the current value of the property at the moment the <a href="qml-qtquick-behavior.html">Behavior</a> is triggered.</p>
<p><b>请参考 </b><a href="qtquick-statesanimations-animations.html">Animation 和 Transitions in Qt Quick</a>。</p>
</div></div><!-- @@@from -->
<br/>
<!-- $$$properties -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="properties-prop">
<td class="tblQmlPropNode"><p>
<a name="properties-prop"></a><span class="name">properties</span> : <span class="type"><a href="../qtqml/qml-string.html">string</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties are used as a set to determine which properties should be animated. The singular and plural forms are functionally identical, e.g&#x2e;</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theItem</span>; <span class="name">property</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }

</pre>
<p>has the same meaning as</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: <span class="name">theItem</span>; <span class="name">properties</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }

</pre>
<p>The singular forms are slightly optimized, so if you do have only a single target/property to animate you should try to use them.</p>
<p>The <code>targets</code> property allows multiple targets to be set. For example, this animates the <code>x</code> property of both <code>itemA</code> and <code>itemB</code>:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: [<span class="name">itemA</span>, <span class="name">itemB</span>]; <span class="name">properties</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }

</pre>
<p>In many cases these properties do not need to be explicitly specified, as they can be inferred from the animation framework:</p>
<div class="table"><table class="generic" width="80%">
 <tr valign="top" class="odd"><td >Value Source / Behavior</td><td >When an animation is used as a value source or in a Behavior, the default target and property name to be animated can both be inferred.<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">theRect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
      NumberAnimation on <span class="name">x</span> { <span class="name">to</span>: <span class="number">500</span>; <span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span> } <span class="comment">//animate theRect's x property</span>
      Behavior on <span class="name">y</span> { <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> {} } <span class="comment">//animate theRect's y property</span>
  }

</pre>
</td></tr>
<tr valign="top" class="even"><td >Transition</td><td >When used in a transition, a property animation is assumed to match <i>all</i> targets but <i>no</i> properties. In practice, that means you need to specify at least the properties in order for the animation to do anything.<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">theRect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
      <span class="type"><a href="qml-qtquick-item.html">Item</a></span> { <span class="name">id</span>: <span class="name">uselessItem</span> }
      <span class="name">states</span>: <span class="name">State</span> {
          <span class="name">name</span>: <span class="string">&quot;state1&quot;</span>
          <span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">x</span>: <span class="number">200</span>; <span class="name">y</span>: <span class="number">200</span>; <span class="name">z</span>: <span class="number">4</span> }
          <span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">uselessItem</span>; <span class="name">x</span>: <span class="number">10</span>; <span class="name">y</span>: <span class="number">10</span>; <span class="name">z</span>: <span class="number">2</span> }
      }
      <span class="name">transitions</span>: <span class="name">Transition</span> {
          <span class="comment">//animate both theRect's and uselessItem's x and y to their final values</span>
          <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">properties</span>: <span class="string">&quot;x,y&quot;</span> }

          <span class="comment">//animate theRect's z to its final value</span>
          <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">&quot;z&quot;</span> }
      }
  }

</pre>
</td></tr>
<tr valign="top" class="odd"><td >Standalone</td><td >When an animation is used standalone, both the target and property need to be explicitly specified.<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">theRect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
      <span class="comment">//need to explicitly specify target and property</span>
      <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">id</span>: <span class="name">theAnim</span>; <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }
      <span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
          <span class="name">anchors</span>.fill: <span class="name">parent</span>
          <span class="name">onClicked</span>: <span class="name">theAnim</span>.<span class="name">start</span>()
      }
  }

</pre>
</td></tr>
</table></div>
<p>As seen in the above example, properties is specified as a comma-separated string of property names to animate.</p>
<p><b>请参考 </b><a href="qml-qtquick-propertyanimation.html#exclude-prop">exclude</a> 和 <a href="qtquick-statesanimations-animations.html">Animation 和 Transitions in Qt Quick</a>。</p>
</div></div><!-- @@@properties -->
<br/>
<!-- $$$property -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="property-prop">
<td class="tblQmlPropNode"><p>
<a name="property-prop"></a><span class="name">property</span> : <span class="type"><a href="../qtqml/qml-string.html">string</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties are used as a set to determine which properties should be animated. The singular and plural forms are functionally identical, e.g&#x2e;</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theItem</span>; <span class="name">property</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }

</pre>
<p>has the same meaning as</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: <span class="name">theItem</span>; <span class="name">properties</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }

</pre>
<p>The singular forms are slightly optimized, so if you do have only a single target/property to animate you should try to use them.</p>
<p>The <code>targets</code> property allows multiple targets to be set. For example, this animates the <code>x</code> property of both <code>itemA</code> and <code>itemB</code>:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: [<span class="name">itemA</span>, <span class="name">itemB</span>]; <span class="name">properties</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }

</pre>
<p>In many cases these properties do not need to be explicitly specified, as they can be inferred from the animation framework:</p>
<div class="table"><table class="generic" width="80%">
 <tr valign="top" class="odd"><td >Value Source / Behavior</td><td >When an animation is used as a value source or in a Behavior, the default target and property name to be animated can both be inferred.<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">theRect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
      NumberAnimation on <span class="name">x</span> { <span class="name">to</span>: <span class="number">500</span>; <span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span> } <span class="comment">//animate theRect's x property</span>
      Behavior on <span class="name">y</span> { <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> {} } <span class="comment">//animate theRect's y property</span>
  }

</pre>
</td></tr>
<tr valign="top" class="even"><td >Transition</td><td >When used in a transition, a property animation is assumed to match <i>all</i> targets but <i>no</i> properties. In practice, that means you need to specify at least the properties in order for the animation to do anything.<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">theRect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
      <span class="type"><a href="qml-qtquick-item.html">Item</a></span> { <span class="name">id</span>: <span class="name">uselessItem</span> }
      <span class="name">states</span>: <span class="name">State</span> {
          <span class="name">name</span>: <span class="string">&quot;state1&quot;</span>
          <span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">x</span>: <span class="number">200</span>; <span class="name">y</span>: <span class="number">200</span>; <span class="name">z</span>: <span class="number">4</span> }
          <span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">uselessItem</span>; <span class="name">x</span>: <span class="number">10</span>; <span class="name">y</span>: <span class="number">10</span>; <span class="name">z</span>: <span class="number">2</span> }
      }
      <span class="name">transitions</span>: <span class="name">Transition</span> {
          <span class="comment">//animate both theRect's and uselessItem's x and y to their final values</span>
          <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">properties</span>: <span class="string">&quot;x,y&quot;</span> }

          <span class="comment">//animate theRect's z to its final value</span>
          <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">&quot;z&quot;</span> }
      }
  }

</pre>
</td></tr>
<tr valign="top" class="odd"><td >Standalone</td><td >When an animation is used standalone, both the target and property need to be explicitly specified.<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">theRect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
      <span class="comment">//need to explicitly specify target and property</span>
      <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">id</span>: <span class="name">theAnim</span>; <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }
      <span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
          <span class="name">anchors</span>.fill: <span class="name">parent</span>
          <span class="name">onClicked</span>: <span class="name">theAnim</span>.<span class="name">start</span>()
      }
  }

</pre>
</td></tr>
</table></div>
<p>As seen in the above example, properties is specified as a comma-separated string of property names to animate.</p>
<p><b>请参考 </b><a href="qml-qtquick-propertyanimation.html#exclude-prop">exclude</a> 和 <a href="qtquick-statesanimations-animations.html">Animation 和 Transitions in Qt Quick</a>。</p>
</div></div><!-- @@@property -->
<br/>
<!-- $$$target -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="target-prop">
<td class="tblQmlPropNode"><p>
<a name="target-prop"></a><span class="name">target</span> : <span class="type">Object</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties are used as a set to determine which properties should be animated. The singular and plural forms are functionally identical, e.g&#x2e;</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theItem</span>; <span class="name">property</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }

</pre>
<p>has the same meaning as</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: <span class="name">theItem</span>; <span class="name">properties</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }

</pre>
<p>The singular forms are slightly optimized, so if you do have only a single target/property to animate you should try to use them.</p>
<p>The <code>targets</code> property allows multiple targets to be set. For example, this animates the <code>x</code> property of both <code>itemA</code> and <code>itemB</code>:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: [<span class="name">itemA</span>, <span class="name">itemB</span>]; <span class="name">properties</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }

</pre>
<p>In many cases these properties do not need to be explicitly specified, as they can be inferred from the animation framework:</p>
<div class="table"><table class="generic" width="80%">
 <tr valign="top" class="odd"><td >Value Source / Behavior</td><td >When an animation is used as a value source or in a Behavior, the default target and property name to be animated can both be inferred.<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">theRect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
      NumberAnimation on <span class="name">x</span> { <span class="name">to</span>: <span class="number">500</span>; <span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span> } <span class="comment">//animate theRect's x property</span>
      Behavior on <span class="name">y</span> { <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> {} } <span class="comment">//animate theRect's y property</span>
  }

</pre>
</td></tr>
<tr valign="top" class="even"><td >Transition</td><td >When used in a transition, a property animation is assumed to match <i>all</i> targets but <i>no</i> properties. In practice, that means you need to specify at least the properties in order for the animation to do anything.<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">theRect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
      <span class="type"><a href="qml-qtquick-item.html">Item</a></span> { <span class="name">id</span>: <span class="name">uselessItem</span> }
      <span class="name">states</span>: <span class="name">State</span> {
          <span class="name">name</span>: <span class="string">&quot;state1&quot;</span>
          <span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">x</span>: <span class="number">200</span>; <span class="name">y</span>: <span class="number">200</span>; <span class="name">z</span>: <span class="number">4</span> }
          <span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">uselessItem</span>; <span class="name">x</span>: <span class="number">10</span>; <span class="name">y</span>: <span class="number">10</span>; <span class="name">z</span>: <span class="number">2</span> }
      }
      <span class="name">transitions</span>: <span class="name">Transition</span> {
          <span class="comment">//animate both theRect's and uselessItem's x and y to their final values</span>
          <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">properties</span>: <span class="string">&quot;x,y&quot;</span> }

          <span class="comment">//animate theRect's z to its final value</span>
          <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">&quot;z&quot;</span> }
      }
  }

</pre>
</td></tr>
<tr valign="top" class="odd"><td >Standalone</td><td >When an animation is used standalone, both the target and property need to be explicitly specified.<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">theRect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
      <span class="comment">//need to explicitly specify target and property</span>
      <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">id</span>: <span class="name">theAnim</span>; <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }
      <span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
          <span class="name">anchors</span>.fill: <span class="name">parent</span>
          <span class="name">onClicked</span>: <span class="name">theAnim</span>.<span class="name">start</span>()
      }
  }

</pre>
</td></tr>
</table></div>
<p>As seen in the above example, properties is specified as a comma-separated string of property names to animate.</p>
<p><b>请参考 </b><a href="qml-qtquick-propertyanimation.html#exclude-prop">exclude</a> 和 <a href="qtquick-statesanimations-animations.html">Animation 和 Transitions in Qt Quick</a>。</p>
</div></div><!-- @@@target -->
<br/>
<!-- $$$targets -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="targets-prop">
<td class="tblQmlPropNode"><p>
<a name="targets-prop"></a><span class="name">targets</span> : <span class="type"><a href="../qtqml/qml-list.html">list</a></span>&lt;<span class="type">Object</span>&gt;</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties are used as a set to determine which properties should be animated. The singular and plural forms are functionally identical, e.g&#x2e;</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theItem</span>; <span class="name">property</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }

</pre>
<p>has the same meaning as</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: <span class="name">theItem</span>; <span class="name">properties</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }

</pre>
<p>The singular forms are slightly optimized, so if you do have only a single target/property to animate you should try to use them.</p>
<p>The <code>targets</code> property allows multiple targets to be set. For example, this animates the <code>x</code> property of both <code>itemA</code> and <code>itemB</code>:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: [<span class="name">itemA</span>, <span class="name">itemB</span>]; <span class="name">properties</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }

</pre>
<p>In many cases these properties do not need to be explicitly specified, as they can be inferred from the animation framework:</p>
<div class="table"><table class="generic" width="80%">
 <tr valign="top" class="odd"><td >Value Source / Behavior</td><td >When an animation is used as a value source or in a Behavior, the default target and property name to be animated can both be inferred.<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">theRect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
      NumberAnimation on <span class="name">x</span> { <span class="name">to</span>: <span class="number">500</span>; <span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span> } <span class="comment">//animate theRect's x property</span>
      Behavior on <span class="name">y</span> { <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> {} } <span class="comment">//animate theRect's y property</span>
  }

</pre>
</td></tr>
<tr valign="top" class="even"><td >Transition</td><td >When used in a transition, a property animation is assumed to match <i>all</i> targets but <i>no</i> properties. In practice, that means you need to specify at least the properties in order for the animation to do anything.<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">theRect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
      <span class="type"><a href="qml-qtquick-item.html">Item</a></span> { <span class="name">id</span>: <span class="name">uselessItem</span> }
      <span class="name">states</span>: <span class="name">State</span> {
          <span class="name">name</span>: <span class="string">&quot;state1&quot;</span>
          <span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">x</span>: <span class="number">200</span>; <span class="name">y</span>: <span class="number">200</span>; <span class="name">z</span>: <span class="number">4</span> }
          <span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">uselessItem</span>; <span class="name">x</span>: <span class="number">10</span>; <span class="name">y</span>: <span class="number">10</span>; <span class="name">z</span>: <span class="number">2</span> }
      }
      <span class="name">transitions</span>: <span class="name">Transition</span> {
          <span class="comment">//animate both theRect's and uselessItem's x and y to their final values</span>
          <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">properties</span>: <span class="string">&quot;x,y&quot;</span> }

          <span class="comment">//animate theRect's z to its final value</span>
          <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">&quot;z&quot;</span> }
      }
  }

</pre>
</td></tr>
<tr valign="top" class="odd"><td >Standalone</td><td >When an animation is used standalone, both the target and property need to be explicitly specified.<pre class="qml">

  <span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
      <span class="name">id</span>: <span class="name">theRect</span>
      <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
      <span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
      <span class="comment">//need to explicitly specify target and property</span>
      <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">id</span>: <span class="name">theAnim</span>; <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">&quot;x&quot;</span>; <span class="name">to</span>: <span class="number">500</span> }
      <span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
          <span class="name">anchors</span>.fill: <span class="name">parent</span>
          <span class="name">onClicked</span>: <span class="name">theAnim</span>.<span class="name">start</span>()
      }
  }

</pre>
</td></tr>
</table></div>
<p>As seen in the above example, properties is specified as a comma-separated string of property names to animate.</p>
<p><b>请参考 </b><a href="qml-qtquick-propertyanimation.html#exclude-prop">exclude</a> 和 <a href="qtquick-statesanimations-animations.html">Animation 和 Transitions in Qt Quick</a>。</p>
</div></div><!-- @@@targets -->
<br/>
<!-- $$$to -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="to-prop">
<td class="tblQmlPropNode"><p>
<a name="to-prop"></a><span class="name">to</span> : <span class="type"><a href="../qtqml/qml-variant.html">variant</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the end value for the animation.</p>
<p>If the <a href="qtquick-animation-example.html#propertyanimation">PropertyAnimation</a> is defined within a <a href="qmlexampletoggleswitch.html#transition">Transition</a> or <a href="qml-qtquick-behavior.html">Behavior</a>, this value defaults to the value defined in the end state of the <a href="qmlexampletoggleswitch.html#transition">Transition</a>, or the value of the property change that triggered the <a href="qml-qtquick-behavior.html">Behavior</a>.</p>
<p><b>请参考 </b><a href="qtquick-statesanimations-animations.html">Animation 和 Transitions in Qt Quick</a>。</p>
</div></div><!-- @@@to -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
